#pragma once

#include "spotLight.h"
#include <math.h>
#include "cugl.h"
#include "Map.h"
#include "Robot.h"
#include <map>


class ControlUnit
{
public:
	ControlUnit(Map *);
	//ControlUnit(void);
	void display();
	void setBoundaries();
	bool onRobot();
	Robot* getCurrentRobot();
	bool onBuilding();
	void moveForward();
	void moveBackward();
	void moveLeft();
	void moveRight();
	void moveUp();
	void moveDown();
	void detach();
	void animate();
	cugl::Camera* getCamera();
	//void setMapControlUnit(std::map<int, ControlUnit*>*);
	void setMapRobots(std::map<int, Robot*>*);
	void setID(int);
	int getID();
	int getX();
	int getY();
	int getZ();
	~ControlUnit(void);
	spotLight* getLight();
	
	void setLocation(GLfloat, GLfloat, GLfloat);

	
private:
	void cube();
	void loadImage();
	void move(GLfloat, GLfloat, GLfloat);

	GLfloat maxHeight;

	//orientation of control unit on robot in radians
	GLfloat angle;
	
	// position
	GLfloat x;
	GLfloat y;
	GLfloat z;

	// size of map
	GLfloat sizeX;
	GLfloat sizeZ;

	// animation
	int flagAnimation;

	int id;

	GLfloat baseHeight;
	GLfloat baseWidth;
	GLfloat midcubeWidth;
	GLfloat midcubeHeight;
	GLfloat midTopWidth;
	GLfloat midTopHeight;

	GLuint goldenTexture;

	// light (bottom)
	spotLight* cuSpotLight;

	// camera
	cugl::Camera cuCamera;

	//map
	Map *map;
	//Map *mapRobots;

	//robot
	Robot *currentRobot;

	//ID map to ControlUnit pointer
	//std::map<int, ControlUnit*> *mapControlUnit;

	//ID map to Robot pointer
	std::map<int, Robot*> *mapRobots;
};

